package com.xiaojian.pick.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

/**
 * 商品类
 */
@Data
public class Commodity {
    private Integer id;  // id
    private String title;  //商品标题
    private Double oldPrice;    // 原价
    private Double price;   // 现价
    private String quality; // 品质（九成新，使用时长）
    private Integer repertory;  // 库存数量
    private Integer clickCount = 0; // 浏览量
    private Integer collectCount = 0;   // 收藏数
    private Integer state;      // 商品状态（1，出售中；2，售罄；3，下架）
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date publishDate;   // 发布时间
    private String coverImage;  // 商品封面
    private String serial;      // 商品编号
    private String description; // 商品描述
    private Boolean swiper;     // 是否为 轮播图

    private Category category;  // 商品分类
    private User user;      // 商品发布者
    private List<CommodityImg> commodityImgList;    // 商品图片列表

    public Commodity(Integer id, String title, Double oldPrice, Double price, String quality, Integer repertory, Integer clickCount, Integer collectCount, Integer state, Date publishDate, String coverImage, String serial, String description, Boolean swiper, Category category, User user, List<CommodityImg> commodityImgList) {
        this.id = id;
        this.title = title;
        this.oldPrice = oldPrice;
        this.price = price;
        this.quality = quality;
        this.repertory = repertory;
        this.clickCount = clickCount;
        this.collectCount = collectCount;
        this.state = state;
        this.publishDate = publishDate;
        this.coverImage = coverImage;
        this.serial = serial;
        this.description = description;
        this.swiper = swiper;
        this.category = category;
        this.user = user;
        this.commodityImgList = commodityImgList;
    }
    public Commodity(){

    }
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Double getOldPrice() {
        return oldPrice;
    }

    public void setOldPrice(Double oldPrice) {
        this.oldPrice = oldPrice;
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    public String getQuality() {
        return quality;
    }

    public void setQuality(String quality) {
        this.quality = quality;
    }

    public Integer getRepertory() {
        return repertory;
    }

    public void setRepertory(Integer repertory) {
        this.repertory = repertory;
    }

    public Integer getClickCount() {
        return clickCount;
    }

    public void setClickCount(Integer clickCount) {
        this.clickCount = clickCount;
    }

    public Integer getCollectCount() {
        return collectCount;
    }

    public void setCollectCount(Integer collectCount) {
        this.collectCount = collectCount;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public Date getPublishDate() {
        return publishDate;
    }

    public void setPublishDate(Date publishDate) {
        this.publishDate = publishDate;
    }

    public String getCoverImage() {
        return coverImage;
    }

    public void setCoverImage(String coverImage) {
        this.coverImage = coverImage;
    }

    public String getSerial() {
        return serial;
    }

    public void setSerial(String serial) {
        this.serial = serial;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Boolean getSwiper() {
        return swiper;
    }

    public void setSwiper(Boolean swiper) {
        this.swiper = swiper;
    }

    public Category getCategory() {
        return category;
    }

    public void setCategory(Category category) {
        this.category = category;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public List<CommodityImg> getCommodityImgList() {
        return commodityImgList;
    }

    public void setCommodityImgList(List<CommodityImg> commodityImgList) {
        this.commodityImgList = commodityImgList;
    }
}